from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time


def perform_mouse_actions():
    # 指定WebDriver路径（如果不在系统PATH中）
    driver_path = 'chromedriver.exe'
    driver = webdriver.Chrome(service=Service(driver_path))

    # # 如果WebDriver在系统PATH中，可以直接初始化
    # driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get("https://www.baidu.com")
    driver.find_element(By.ID, "kw").send_keys("selenium")
    # 单击左键
    driver.find_element(By.ID, "su").click()
    time.sleep(2)


if __name__ == "__main__":
    perform_mouse_actions()
